<template>
  <el-dialog title="收货地址" :visible.sync="dataList.type">
    <el-form :model="dataList" :rules="rules">
      <el-form-item label="管理员账号" :label-width="formLabelWidth" prop="account">
        <el-input v-model="dataList.account" autocomplete="off" placeholder="请输入管理员账号"></el-input>
      </el-form-item>

      <el-form-item label="管理员密码" :label-width="formLabelWidth" prop="pwd">
        <el-input
          v-model="dataList.pwd"
          autocomplete="off"
          placeholder="请输入管理员密码"
        ></el-input>
      </el-form-item>

      <el-form-item
        label="确认密码"
        :label-width="formLabelWidth"
        prop="conf_pwd"
      >
        <el-input
          v-model="dataList.conf_pwd"
          autocomplete="off"
          placeholder="请输入确认密码"
        ></el-input>
      </el-form-item>

      <el-form-item
        label="管理员姓名"
        :label-width="formLabelWidth"
        prop="real_name"
      >
        <el-input
          v-model="dataList.real_name"
          autocomplete="off"
          placeholder="请输入管理员姓名"
        ></el-input>
      </el-form-item>

      <el-form-item
        label="管理员身份"
        :label-width="formLabelWidth"
        prop="roles"
      >
        <el-select v-model="dataList.roles" multiple  placeholder="请选择管理员身份">
          <el-option label="信息录入员" :value="6"> </el-option>
          <el-option label="财务管理员" :value="7"> </el-option>
          <el-option label="商家" :value="8"> </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="状态" :label-width="formLabelWidth">
        <el-radio-group v-model="dataList.status">
          <el-radio :label="1">开启</el-radio>
          <el-radio :label="0">关闭</el-radio>
        </el-radio-group>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dataList.type = false">取 消</el-button>
      <el-button type="primary" @click="sure">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { motai } from "../../api/AdministratorList";
export default {
  props: ["dataList"],
  data() {
    return {
      formLabelWidth: "120px",
      rules: {
        account:[{ required: true, message: "请输入管理员账号", trigger: "blur" }],
        pwd: [{ required: true, message: "请输入管理员密码", trigger: "blur" }],
        conf_pwd: [
          { required: true, message: "请输入确认密码", trigger: "blur" },
        ],
        real_name: [
          { required: true, message: "请输入管理员姓名", trigger: "blur" },
        ],
        roles: [
          { required: true, message: "请选择管理员身份", trigger: "blur" },
        ],
      },
    };
  },
  created() {
  },

  methods: {
    sure(){
      this.dataList.type = false
      if(this.dataList.id==""){
        this.$emit("add",this.dataList)
      }else{
        this.$emit("edit",this.dataList)
      }
    }
  },
};
</script>
<style lang='scss' scoped>
</style>